package com.jin.gulimall.auth.service.impl;

import com.jin.common.utils.R;
import com.jin.gulimall.auth.component.Face;
import com.jin.gulimall.auth.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.Base64;

@Service
public class AuthServiceImpl implements AuthService {

    @Autowired
    Face faceService;

    @Override
    public R faceAdd(String phone, MultipartFile face) throws IOException {
        String jsonImg = Base64.getEncoder().encodeToString(face.getBytes());
        faceService.faceImgAdd(jsonImg);
        return R.ok();
    }
}
